﻿#include <QThread>
#include <QEventLoop>
#include <QTimer>
#include <QFile>
#include <QCoreApplication>
#include <QDir>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QJsonDocument>
#include "testWebServer.h"

TestWebServer::TestWebServer()
{
}

void TestWebServer::startServer()
{
    m_server.start(8080);

    JZWebWidgetPage* page = new JZWebWidgetPage();
    auto root = page->root();
    
    JZWebVBoxLayout* v = new JZWebVBoxLayout();

    JZWebLabel* tips = new JZWebLabel(page);
    tips->setText("input:");

    JZWebTextBox* text1 = new JZWebTextBox(page);
    JZWebTextBox* text2 = new JZWebTextBox(page);

    v->addWidget(text1);
    v->addWidget(tips);
    v->addWidget(text2);

    root->setLayout(v);

    m_server.addPage("index.html",page);
}

int main(int argc, char* argv[])
{
    QCoreApplication app(argc, argv);
    TestWebServer rpc;
    rpc.startServer();

    return app.exec();
}